import { log } from "cc"

import { API } from "./api"
import { Environment } from "./environment"
import { Platform } from "./platform"
import { Tracking } from "./tracking"

import { WatchSystem } from "./watch"
import { Util } from "./util"
import { cat } from "@shimotsuki/core"
import { AudioEffectConstant } from "./constant/AudioEffectConstant"
import { Store } from "./store"
import { JSbridge } from "./jsbridge"



cat.setConfig({ default_audio_effect: AudioEffectConstant.CLICK, gui_bundleName: 'core', audio_local_store_key: 'crazy_watermelon_game_audio' }).onAppInitDelegate.add(async () => {
    console.time('[Business Init]')
    // 数据管理

    cat.merge('store', new Store(cat))
        // 工具类
        .merge('util', new Util(cat))
        // 平台
        .merge('platform', new Platform(cat).platform)
        // 环境
        .merge('env', await new Environment().init())
        // 统计
        .merge('tracking', new Tracking(cat))
        // 接口请求
        .merge('api', new API(cat))
        // 统计
        .merge('watch', new WatchSystem(cat))

        // 桥接
        .merge('jsBridge', new JSbridge(cat))

    // 扩展... TODO
    console.timeEnd('[Business Init]')
})